﻿using System;

namespace _1281_subtract_the_product_and_sum_of_digits_of_an_integer
{
    class Program
    {
        static void Main (string[] args)
        {
            Console.Write(SubtractProductAndSum (234));
        }

        public static int SubtractProductAndSum (int n)
        {
            int sum = 1;
            int add = 0;

            while (n > 0)
            {
                add += n % 10;
                sum *= n % 10;
                n /= 10;
            }
            return sum - add;
        }
    }
}
